{include file="common/header" /}
<section class="content-header">
    <h1>
        {$venue}开放时间表
    </h1>
    <ol class="breadcrumb">
        <li><a href="/"><i class="fa fa-home"></i> 首页</a></li>
        <li class="active">场馆预约</li>
        <li class="active">开放时间表</li>
    </ol>
</section>
<section class="content">
    <div class="box box-default">
        <div class="box-header with-border">
            <h3 class="box-title">
                <a href="/admin/venreserve/opentimes?pid={$dateinfo.pid}" ><span class="label label-back" onclick='goback()'><i class="fa fa-chevron-left"></i> 返回</span></a>
            </h3>
        </div>
        <form method="post">
			<input type="hidden" name="id" value="{$dateinfo.id}">
            <input type="hidden" name="pid" value="{$dateinfo.pid}">
            <div class="box-body">
				<div class="row">
				  <div class="col-md-6 form-group">
					<label>活动名称</label>
					<input name="title" type="text" value="{$dateinfo.title}" class="form-control" required placeholder="活动名称"/>
				  </div>
				</div>
				<div class="row">
				  <div class="col-md-6 form-group">
					<label>时间类型</label>
					<div data-toggle="buttons">
						<label class="btn btn-default">
							<input type="radio" name="timetype" value="1"{if condition="$dateinfo.timetype eq 1 || !isset($dateinfo['timetype'])"} checked{/if}> 日期
						</label>
						<label class="btn btn-default">
							<input type="radio" name="timetype" value="2"{if condition="$dateinfo.timetype eq 2"} checked{/if}> 星期
						</label>
					</div>
				  </div>
				</div>
				<div class="row" id="datetype">
                    <div class="col-md-6 form-group">
                        <label>日期</label>
                        <input name="date" type="text" value="{$dateinfo.date}" autocomplete="off" class="form-control" id="date" />
                    </div>
                </div>
				<div class="row" id="weektype">
				  <div class="col-md-6 form-group">
					<label>星期</label>
					<select name="week" class="form-control">
						<option value=''>--请选择--</option>
						<option value='1' {if $dateinfo.week eq 1}selected{/if}>周一</option>
						<option value='2' {if $dateinfo.week eq 2}selected{/if}>周二</option>
						<option value='3' {if $dateinfo.week eq 3}selected{/if}>周三</option>
						<option value='4' {if $dateinfo.week eq 4}selected{/if}>周四</option>
						<option value='5' {if $dateinfo.week eq 5}selected{/if}>周五</option>
						<option value='6' {if $dateinfo.week eq 6}selected{/if}>周六</option>
						<option value='7' {if $dateinfo.week eq 7}selected{/if}>周日</option>
					</select>
				  </div>
				</div>
                <div class="row">
                    <div class="col-md-6 form-group">
                        <label>预约时间段</label>
                        <input name="dateinfo" type="text" value="{$dateinfo.dateinfo}"  autocomplete="off" class="form-control" id="dateinfo" required="required" />
                    </div>
                </div>
				<div class="row">
				  <div class="col-md-6 form-group">
					<label>活动人数上限</label>
					<input name="peoplelimit" type="number" value="{$dateinfo.peoplelimit|default=100}" class="form-control" required placeholder="活动人数上限"/>
				  </div>
				</div>
				<div class="row">
				  <div class="col-md-6 form-group">
					<label>排序</label>
					<input name="sort" type="number" value="{$dateinfo.sort|default=1}" class="form-control" required placeholder="数值越大越靠前"/>
				  </div>
				</div>
				<div class="row">
				  <div class="col-md-6 form-group">
					<label>活动详情</label>
					<textarea name="content" class="form-control" placeholder="活动详情" style="height:100px"/>{$dateinfo.content}</textarea>
				  </div>
				</div>
            </div>
            <div class="box-footer">
                <input type="submit"  value="保存" class="btn btn-primary" />
                <input type="button" value="取消" onclick="javascript:history.back(-1);"  class="btn btn-default" />
            </div>
        </form>
    </div>
</section>
<script src="/plugins/laydate/laydate.js"></script>
<script type="text/javascript">
    laydate.render({
        elem: '#dateinfo',
        type: 'time' ,
        range: true,
        format: 'HH:mm'
    });
	
	laydate.render({
        elem: '#date',
        type: 'date' ,
        format: 'yyyy-MM-dd'
    });
	
	$(function(){
		var timetype = '{$dateinfo.timetype}';
		if(timetype == 2)
		{
			$('#weektype').show();
			$('#datetype').hide();
		}
		else
		{
			$('#weektype').hide();
			$('#datetype').show();
		}
	});
	
	$("input[name='timetype']").on('ifChanged', function(){
		var timetype = $("input[name='timetype']:checked").val();
		if (timetype == 2)
		{
			$('#weektype').show();
			$('#datetype').hide();
		}
		else
		{
			$('#weektype').hide();
			$('#datetype').show();
		}
	});
</script>
{include file="common/footer" /}